import request from '@/utils/request'

/** 养护管理*/
//新增养护计划
export function conserveplanAdd(params) {
    return request({
      url: '/device/deviceConserveplan/save',
      method: 'post',
      data:params,
    })
}
//查询养护计划列表
export function conserveplanList(params) {
    return request({
      url: `/device/deviceConserveplan/list`,
      method: 'get',
      params
    })
}
//查询养护计划详细信息并查询该单据下养护任务
export function conserveplanDes(params) {
    return request({
      url: `/device/deviceConserveplan/newgetConserveplanByid`,
      method: 'get',
      params
    })
}
//修改养护计划
export function conserveplanEdit(params) {
    return request({
      url: '/device/deviceConserveplan/update',
      method: 'put',
      data:params,
    })
}
//查询养护计划详细信息
export function conserveplanInfo(id) {
  return request({
    url: `/device/deviceConserveplan/${id}`,
    method: 'get'
  })
}
//导出养护计划信息列表Excel
export function conserveplanExport(params) {
    return request({
      url: `/device/deviceConserveplan/export`,
      method: 'get',
      params
    })
}
//
export function conserveType() {
  return request({
    url: `/system/dict/data/selectconservetype`,
    method: 'get'
  })
}

/***养护任务****/
//查询养护任务列表
export function conservetaskList(params) {
    return request({
      url: `/device/deviceConservetask/list`,
      method: 'get',
      params
    })
}
//新增临时养护任务
export function conservetaskAdd(params) {
    return request({
      url: '/device/deviceConservetask/save',
      method: 'post',
      data:params,
    })
}
//查询养护任务详细信息
export function conservetaskInfo(id) {
    return request({
      url: `/device/deviceConservetask/${id}`,
      method: 'get'
    })
}
//修改养护任务
export function conservetaskEdit(params) {
    return request({
      url: '/device/deviceConservetask/update',
      method: 'put',
      data:params,
    })
}
//转派
export function conservetaskChargeuser(params) {
    return request({
      url: `/device/deviceConservetask/updateChargeuser?chargeUser=${params.chargeUser}&id=${params.id}`,
      method: 'put',
    })
}
//作废
export function conservetaskDel(id) {
    return request({
      url: `/device/deviceConservetask/updateTaskStatus?id=${id}`,
      method: 'put',
    })
}
//费用
export function feiyong(){
    return request({
        url: `/system/dict/data/selectCostType`,
        method: 'get',
    })
}
//查询实施人员列表
export function implementer(params){
    return request({
        url: `/device/implementer/list`,
        method: 'get',
        params
    })
}

/***养护记录***/
//查询养护计划用于养护记录
export function getConservePlanList(params){
  return request({
      url: `/device/deviceConserveplan/getConservePlanList`,
      method: 'get',
      params
  })
}
//
export function getConserveTaskList(params){
  return request({
      url: `/device/deviceConservetask/selectConserveTaskByDate`,
      method: 'get',
      params
  })
}
//查询已完成养护任务（养护记录）
export function conserveRecordList(params){
  return request({
      url: `/device/deviceConservetask/selectConserveRecord`,
      method: 'get',
      params
  })
}
//
export function conserveRecordDes(params){
  return request({
      url: `/device/deviceConservetask/getTemporaryTaskById`,
      method: 'get',
      params
  })
}
//新增临时养护任务
export function conserveRecordAdd(params){
  return request({
      url: `/device/deviceConservetask/save`,
      method: 'post',
      data:params
  })
}

